package math.vector;

import math.Maths;

public class vec3i
{

    public int x;
    public int y;
    public int z;

    public vec3i() 
    {
        this.x = 0;
        this.y = 0;
        this.z = 0;
    }
    
    public vec3i(int x_coord, int y_coord, int z_coord) 
    {
        this.x = x_coord;
        this.y = y_coord;
        this.z = z_coord;
    }
    
    public vec3i(int value)
    {
        this(value, value, value);
    }

    public vec3i(float x_coord, float y_coord, float z_coord) 
    {
        this(
            Maths.nearestInt(x_coord), 
            Maths.nearestInt(y_coord), 
            Maths.nearestInt(z_coord)
        );
    }
    
    public vec3i(double x_coord, double y_coord, double z_coord) 
    {
        this(
            (float) x_coord, 
            (float) y_coord, 
            (float) z_coord
        );
    }

    public vec3i(vec3i vec) 
    {
        this(vec.x, vec.y, vec.z);
    }
    
    public vec3i(vec3f vecf) 
    {
        this(vecf.x, vecf.y, vecf.z);
    }
    
    public void swapWith(vec3i vec) 
    {
        vec3i vt = new vec3i(vec);
        vec.setTo(this);
        this.setTo(vt);
    }
    
    public void setTo(int xOther, int yOther, int zOther) 
    {
        this.x = xOther;
        this.y = yOther;
        this.z = zOther;
    }

    public void setTo(vec3i other) 
    {
        this.setTo(other.x, other.y, other.z);
    }
    
    public String toString() 
    {
        String s = "";
        s += "( " + x + ", " + y + ", " + z + " )";
        return s;
    }
    
}
